package com.le.tester.javaThink.fifth.chapter24_ConcurrentProgramming;

import java.util.Arrays;

/**
 * createTime：2021/8/17 15:43
 * description：使用的是parallel和parallelSetAll
 */
public class Summing4 {
    public static void main(String[] args) {
        System.out.println(Summing3.CHECK);
        Long[] longs = new Long[Summing3.SZ + 1];
        Arrays.parallelSetAll(longs, i -> (long) i);
        Summing.timeTest("Long Parallel", Summing3.CHECK,
                () -> Arrays.stream(longs)
                        .parallel()
                        .reduce(0L, Long::sum));
    }
}
